package core;

import java.awt.BorderLayout;
import java.awt.EventQueue;

import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import javax.swing.GroupLayout;
import javax.swing.GroupLayout.Alignment;
import java.awt.GridLayout;
import javax.swing.Box;
import java.awt.Component;
import java.awt.GridBagLayout;
import java.awt.GridBagConstraints;
import java.awt.Insets;

public class GameFrame extends JFrame {

  private Board board;
  private ScorePane scorePane;
  
  public void dropTetro() {
  
    scorePane.dropTetro();
  }
  
  public void clearLines(int lines) {
  
    scorePane.clearLines(lines);
  }
  
/**
 * Create the frame.
 */
public GameFrame() {

    GridBagLayout gridBagLayout = new GridBagLayout();
    gridBagLayout.columnWidths = new int[] {100};
    gridBagLayout.rowHeights = new int[]{0, 0};
    gridBagLayout.columnWeights = new double[]{0.0, 0.0, 0.0, 0.0};
    gridBagLayout.rowWeights = new double[]{1.0, Double.MIN_VALUE};
    getContentPane().setLayout(gridBagLayout);
    
    scorePane = new ScorePane(1);
    GridLayout gridLayout = (GridLayout) scorePane.getLayout();
    gridLayout.setColumns(4);
    gridLayout.setRows(0);
    GridBagConstraints gbc_scorePane = new GridBagConstraints();
    gbc_scorePane.gridwidth = 3;
    gbc_scorePane.insets = new Insets(0, 0, 0, 5);
    gbc_scorePane.fill = GridBagConstraints.BOTH;
    gbc_scorePane.gridx = 0;
    gbc_scorePane.gridy = 0;
    getContentPane().add(scorePane, gbc_scorePane);
    
    board = new Board();
    GridBagConstraints gbc_board = new GridBagConstraints();
    gbc_board.fill = GridBagConstraints.BOTH;
    gbc_board.gridx = 3;
    gbc_board.gridy = 0;
    getContentPane().add(board, gbc_board);
    
    board.registerParentFrame(this);
    setSize(600, 600);
  }

}
